#include <stdio.h>  
#include <math.h>  
  
int month[12] = {0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304};  
  
int main() {  
    int y, m = 5, d = 1, x;  
    if (scanf("%d", &y));  
    x = (y - 1900) % 4 == 0 ? m <= 2 ? -1 : 0 : 0;  
    m = month[m];  
    d += (y - 1900) / 4 - (y - 1900) / 100 + (y - 1900) / 400;  
    int week = ((y - 1900) * 365 + m + d + 1 + x) % 7;  
    week = !week ? 7 : week;  
    printf("%d\n", 15 - week);  
    return 0;  
}  